using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

//Importamos
using EventSys.BussinesEntities;

namespace EventSys.Repository.Mapping
{
    public class MaterialMap : EntityTypeConfiguration<Material>
    {
        public MaterialMap()
        {
            // Primary Key
            this.HasKey(t => t.idMaterial);

            // Properties
            this.Property(t => t.Material1)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("Material");
            this.Property(t => t.idMaterial).HasColumnName("idMaterial");
            this.Property(t => t.idActividad).HasColumnName("idActividad");
            this.Property(t => t.Material1).HasColumnName("Material");
            this.Property(t => t.Cantidad).HasColumnName("Cantidad");
            this.Property(t => t.Precio).HasColumnName("Precio");
            this.Property(t => t.Monto).HasColumnName("Monto");

            // Relationships
            this.HasOptional(t => t.Actividad)
                .WithMany(t => t.Materials)
                .HasForeignKey(d => d.idActividad);

        }
    }
}